<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>博客</title>

    <link href="public/css/main.css" rel="stylesheet" type="text/css">
    <link href="public/fontAwesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <script src="public/js/jquery-1.12.4.min.js"></script>
    <script src="public/js/index.js"></script>

    
     
<body>

    <header>
        <div class="backimg"><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1551603040&di=59df7e684c674c9934d525537eb9692b&imgtype=jpg&er=1&src=http%3A%2F%2Fwww.zexiaoe.com%2Fupfiles%2Fimages%2Fschools%2F10451%2Fp10451_00002.jpg"></div>
        <div class="logo"><span></span><img src="public/images/00002637.png"></div>
    </header>

    <nav>
        <div class="menu">
            <nav>
                <div class="menu">
                    {% if !category %}
                        <a href="/" class="focus">首页</a>
                    {%else%}
                        <a href="/">首页</a>
                    {% endif %}
                    <!-- 这个部分替换成模板语法 -->
                    {% for cate in categories %}
                    {% if category == cate.id %}
                        <a class="focus" href="/?category={{cate._id.toString()}}">{{cate.name}}</a>
                
                    {%else%}
                    <a href="/?category={{cate._id.toString()}}">{{cate.name}}</a>
                    {% endif %}
                    {% endfor %}
                    
                </div>
            </nav>

        </div>
    </nav>



    <main class="clear">
        
        {% block mainleft %}
            
        {% endblock %}

        <div class="mainRight">
            {% if userInfo._id %}
            <div class="rightBox" id='userInfo'>
                <div class="title"><span>用户信息</span></div>
                <p><span class="colDark" class='username'>{{userInfo.username}}</span></p>

                {% if userInfo.isAdmin%}
                <p class="adminPart" style="text-align: center">
                    <span class="colDanger info">你好，管理员！😁</span>
                    <!--增加一个链接，可以登录后台的链接 -->
                    <a href="/admin"> <button type="button" class="btn btn-primary adminBrn" style="width: 60%;">进入管理</button></a>

                </p>
                {%else%}
                <p><span class="colDanger info" >你好，欢迎光临我的博客！😁</span></p>

                {%endif%}

                <p href="javascript:" style="text-align: center;width: 100%;"><button type="button" class="btn btn-default btn-lg" id="logoutBtn"  style="width: 60%;">退出</button></p>
            </div>

            {% else %}
            <div class="rightBox" id="loginBox">
                <div class="title"><span>登录</span></div>
                <div class="line"><span class="colDark">用户名：</span><input type="text" name="username" /><em></em></div>
                <div class="line"><span class="colDark">密码：</span><input type="password" name="password" /><em></em></div>
                <div class="line"><span class="colDark"></span><button>登 录</button></div>
                <p class="textRight">还没注册？<a href="#" class="colMint">马上注册</a>　</p>
                <p class="colWarning textCenter"></p>
            </div>
            {% endif %}

            <div class="rightBox" id="registerBox" style='display: none'>
                <div class="title"><span>注册</span></div>
                <div class="line"><span class="colDark">用户名：</span><input type="text" name="username" /></div>
                <div class="line"><span class="colDark">密码：</span><input type="password" name="password" /></div>
                <div class="line"><span class="colDark">确认：</span><input type="password" name="repassword" /></div>
                <div class="line"><span class="colDark"></span><button>注 册</button></div>
                <p class="textRight">已有账号？<a href="#" class="colMint">马上登录</a>　</p>
                <p class="colWarning textCenter"></p>
            </div>


            <div class="rightBox community">
                <div class="title"><span>社区</span></div>
                <p><a href="https://github.com/" target="_blank">github</a></p>
                <p><a href="http://www.ldu.edu.cn/" target="_blank">鲁东大学官网</a></p>
                <p><a href="http://jwzx.ytrocar.com/" target="_blank">鲁东教务</a></p>  
            </div>
        </div>


    </main>

    <div class="copyright textCenter">Copyright luozy</div>
</body>

</html>